import React, {Component} from 'react';
import {StyleSheet, Text, View, Image, ScrollView} from 'react-native';
import {
    Button,
    WhiteSpace,
    WingBlank,
    Flex,
    Alert,
} from '@ant-design/react-native';
import {getBankLoanInfo} from '~/api/bank';

export default class FinancialInfo extends Component {
    static navigationOptions = {
        title: '金融产品详情',
    };
    constructor(porps) {
        //调用基类的所有的初始化方法
        super(porps);

        // 设置当前组件的属性
        this.state = {
            id: this.props.navigation.getParam('params'),
            LoanName: '',
            LoanInfo: '',
        };

        getBankLoanInfo(this.state.id).then((r) => {
            if (r.code === 0) {
                this.setState({
                    LoanName: r.data.LoanName,
                    LoanInfo: r.data.LoanInfo,
                });
            } else {
                Alert.alert(r.msg);
            }
        });
    } //
    render() {
        return (
            <ScrollView style={{flex: 1}}>
                <View style={{width: '100%', backgroundColor: 'white'}}>
                    <WingBlank>
                        <Flex justify="center" style={{marginTop: 18}}>
                            <Text style={{fontSize: 20}}>
                                {this.state.LoanName}
                            </Text>
                        </Flex>
                        <ScrollView>
                            <Flex style={{marginTop: 18}}>
                                <Text>{this.state.LoanInfo}</Text>
                            </Flex>
                        </ScrollView>
                    </WingBlank>
                </View>
            </ScrollView>
        );
    }
}

const styles = StyleSheet.create({});
